{template 'common/header'}
{template 'common_css'}
<style type="text/css">
	.control-label{text-align:right;}
	.table ul li {float:left;display:block;padding:0;width:100%;line-height:38px;}
	.table ul li span{float:left;display:block;width:260px;text-align:right;padding:0px 20px;line-height:38px;margin:0 10px 0 0;font-Weight:500;color:#FF6600;background-color:#fcfcfc;}
</style>
<script language="javascript">
function  a(){
        $("#ddd").jqprint();
    }
</script>
<ul class="nav nav-tabs">
	<li><a href="{php echo $this->createWebUrl('display')}">表单列表</a></li>
	<li><a href="{php echo $this->createWebUrl('post')}">新建表单</a></li>
	<li><a href="{php echo $this->createWebUrl('manage', array('id' => $row['reid']))}">表单记录</a></li>
	<li class="active"><a href="#">表单详情</a></li>
	<li><a onclick="a()"><i class="fa fa-print"></i> 打印</a></li>
</ul>
<div class="main">
        <div class="panel panel-default">
			<div class="panel-body table-responsive" id="ddd">
			<div class="panel panel-default table">
				<div class="panel-heading">
					<h4 class="panel-title">表单内容</h4>
				</div>
				<ul class="list-group collapse in">
					{if $activity['paixu'] != 2}
					<li class="list-group-item"><span>姓名：</span>{$row['member']}</li>
					<li class="list-group-item"><span>手机：</span>{$row['mobile']}</li>
					{/if}
					{if !empty($par['comment']) && pdo_tableexists('dayu_comment') && !empty($row['commentid'])}
						<li class="list-group-item">
							<span>打分：</span>
							<div class="ico_scored"><strong class="score_{$comment['score']}"></strong></div>
						</li>
						<li class="list-group-item"><span>评价：</span>
						{$comment['content']}
						</li>
					{/if}
					{if pdo_tableexists('dayu_kami') && !empty($par['kami']) && !empty($row['kid'])}
						<li class="list-group-item"><span>卡密：</span>
						<a target="_blank" class="btn btn-sm btn-success status" style="color:#fff" href="{php echo url('site/entry', array('do' => 'kami','op' => 'detail','m' => 'dayu_kami','cid' => $kami['cid'],'id' => $row['kid']), true, true)}">{$kami['number']}</a>
						</li>
					{/if}
					{if pdo_tableexists('dayu_sendkami') && !empty($par['sendkami']) && !empty($row['kid'])}
						<li class="list-group-item"><span>卡密：</span>
						<a target="_blank" style="color:#fff" href="{php echo url('site/entry', array('do' => 'kami','op' => 'detail','m' => 'dayu_sendkami','cid' => $kami['cid'],'id' => $row['kid']), true, true)}"><dd class="btn btn-sm btn-success status">{$kami['number']}</dd> <dd class="btn btn-sm btn-success status">{$kami['password']}</dd></a>
						</li>
					{/if}
					{if !empty($row['linkage'])}
						<li class="list-group-item"><span>{$la['l1']}：</span>
						{$linkage['l1']['title']}
						</li>
						<li class="list-group-item"><span>{$la['l2']}：</span>
						{$linkage['l2']['title']}
						</li>
					{/if}
					{if $activity['isget']}
                        {if $par['var1']}
						<li class="list-group-item"><span>{$par['var1t']}：</span>{$row['var1']}</li>
						{/if}
                        {if $par['var2']}
                        <li class="list-group-item"><span>{$par['var2t']}：</span>{$row['var2']}</li>
						{/if}
                        {if $par['var3']}
                        <li class="list-group-item"><span>{$par['var3t']}：</span>{$row['var3']}</li>
						{/if}
					{/if}
					{if !empty($row['thumb'])}
						<li class="list-group-item"><span>{$activity['pluraltit']}：</span>
						{loop $row['thumb'] $pic}
						<a target="_blank" href="{php echo tomedia($pic)}"><img src="{php echo tomedia($pic)}" height="100"></a>
						{/loop}
						</li>
					{/if}
					{if $activity['isvoice']==1}
							<li class="list-group-item"><span>{$activity['voice']}：</span>
								{if !empty($row['voice'])}
								<audio controls="controls"><source src="{if strstr($row['voice'], 'http://')}{$row['voice']}{else}{$setting['qiniu']['host']}/{$row['voice']}{/if}" type="audio/mpeg"></audio>
								{/if}
							</li>
					{/if}
					{loop $ds $fid $ftitle}
					{if $ftitle['type'] == 'image' && !empty($ftitle['loc'])}
					{else}
                        <li class="list-group-item"><span>{$ftitle['fid']}：</span>
                            {if in_array($ftitle['type'], array('image', 'photograph'))}
                            {if $row['fields'][$fid]}<a target="_blank" href="{php echo tomedia($row['fields'][$fid]);}"><img src="{php echo tomedia($row['fields'][$fid]);}" height="100"></a>{else}用户未上传{/if}
                            {else}
                            {$row['fields'][$fid]}
                            {/if}&nbsp;
						</li>
						{/if}
					{/loop}
					{if $par['getadd']!='0'}
						<li class="list-group-item"><span>粉丝地址：</span>
							{$row['getadd']}
						</li>
						<li class="list-group-item"><span>粉丝IP：</span>
							{$row['getip']}
						</li>
					{/if}
						<li class="list-group-item"><span>提交时间：</span>{php echo date('Y-m-d H:i:s', $row['createtime']);}</li>
                        <li class="list-group-item"><span>表单状态：</span><dd class="btn btn-default btn-danger {$status['css']}">{$status['name']}</dd></li>
						</ul>
					</div>
            </div>
        </div>
		
	   <div class="panel panel-info">
	<div class="panel-heading">更新表单状态
		</div>
		<div class="panel-body">
							
		{if $_W['uniacid']!='6418'}
		<form enctype="multipart/form-data"  method="post" name="upbookfrom" id="upbookfrom">
		<div class="form-group">
			<label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
			<div class="col-xs-12 col-sm-9">
				<input type="button" id="uploadbookimg" onClick="$('#upload').click()" class="btn btn-success" value="点击上传文件" />
				<input type="file" name="upfile" size="30" id="upload" onChange="upfiles()" style="width:0;height:0;"/>
				上传文件目录：/attachment/dayu_form/{$_W['uniacid']}/file/
			</div>
		</div>
		</form>
		<form method="post" id="form" class="form-horizontal form" action="">
                <div class="form-group">
					<table class="table table-hover">
						<tbody id="listfile">
						{loop $row['file'] $f}
						<tr><td class="col-xs-12 col-sm-3 col-md-2 control-label"></td>
							<td class="col-xs-12 col-sm-9"><input name="file[]" type="text" class="form-control" value="{$f}"/></td>
							<td>
								<a href="javascript:;" onclick="deleteItem(this)" data-toggle="tooltip" data-placement="bottom" title="删除此文件" class="btn btn-default btn-sm"><i class="fa fa-times"></i></a>
							</td>
						</tr>
						{/loop}
						</tbody>
					</table>
                    </div>
					{/if}
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">表单状态：</label>
                    <div class="col-xs-12 col-sm-9">
						<select class="form-control" id="status" name="status">
							{loop $arr2 $c}
								{loop $state[$c] $d}
									<option value="{$c}" {if $row['status'] == $c}selected="selected"{/if}>{$d['name']}</option>
								{/loop}
							{/loop}
						</select>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">受理时间：</label>
                    <div class="col-xs-12 col-sm-9">
							{php echo tpl_form_field_date('yuyuetime', $row['yuyuetime'], true)}
                    </div>
                </div>
					{if $activity['isrethumb']==1}
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">回复图片：</label>
                    <div class="col-xs-12 col-sm-9">
						{php echo tpl_form_field_multi_image('rethumb', $rethumb);}
                    </div>
                </div>
					{/if}
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">快捷回复：</label>
                    <div class="col-xs-12 col-sm-9">
					{loop $custom $v}
						<input type="button" class="btn btn-small" value="{$v['raply']}" onclick="document.getElementById('kfinfo').value+='{$v['raply']}'" />
					{/loop}
                    </div>
                </div>
				<div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">客服备注：</label>
                    <div class="col-xs-12 col-sm-9">
                         <textarea style="height:80px;" class="form-control" id="kfinfo" name="kfinfo" cols="70">{$row['kfinfo']}</textarea>
                    </div>
                </div>
					{if $activity['isrevoice']==1 && !empty($row['revoice'])}
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">语音答复：</label>
                    <div class="col-xs-12 col-sm-9">
					<div class="btn-group">
						<audio controls="controls"><source src="{if strstr($row['revoices'], 'http://')}{$row['revoices']}{else}{$setting['qiniu']['host']}/{$row['revoices']}{/if}" type="audio/mpeg"></audio>
					</div>
                    </div>
                </div>
					{/if}
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
                    <div class="col-xs-12 col-sm-9">
					<input type="hidden" name="id" value="{$row['rerid']}" />
					<input type="submit" name="submit" value="提交" class="btn btn-primary col-lg-1" />
					<input type="hidden" name="token" value="{$_W['token']}" />
                    </div>
				</div>
       </form>
	</div>
</div>

        <div class="panel panel-default" style="margin-top:20px;">
            <div class="panel-heading">
                表单信息
            </div>
            <div class="panel-body">
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">表单标题</label>
                    <div class="col-xs-12 col-sm-9">
                    	<p class="form-control-static">{$activity['title']}</p>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">表单说明</label>
                    <div class="col-xs-12 col-sm-9">
						<p class="form-control-static">{$activity['description']}</p>
                    </div>
                </div>
                     <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">提交提示信息</label>
                    <div class="col-xs-12 col-sm-9">
						<p class="form-control-static">{$activity['information']}</p>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">图片介绍</label>
                    <div class="col-xs-12 col-sm-9">
						<p class="form-control-static"><img src="{php echo tomedia($activity['thumb']);}" style="height:150px;" /></p>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">创建时间</label>
                    <div class="col-xs-12 col-sm-9">
						<p class="form-control-static">{php echo date('Y-m-d H:i:s', $activity['createtime']);}</p>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">开始时间~结束时间</label>
                    <div class="col-xs-12 col-sm-9">
						<p class="form-control-static">{php echo date('Y-m-d H:i:s', $activity['starttime']);} ~ {php echo date('Y-m-d H:i:s', $activity['endtime']);}</p>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">状态</label>
                    <div class="col-xs-12 col-sm-9">
                    	<label>
							<p class="form-control-static">
							{if $activity['status'] == '1'}
								<i class="fa fa-check"> &nbsp; 当前表单生效中</i>
							{else}
								<i class="fa fa-check-empty"> &nbsp; 当前表单已失效</i>
							{/if}
							</p>
						</label>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">微站首页展示</label>
                    <div class="col-xs-12 col-sm-9">
                  		<label>
							<p class="form-control-static">
							{if $activity['inhome'] == '1'}
								<i class="fa fa-check"> &nbsp; 当前表单将展示在微站首页上</i>
							{else}
								<i class="fa fa-check-empty"> &nbsp; 当前表单不显示在微站首页</i>
							{/if}
							</p>
						</label>
                    </div>
                   </div>
            </div>
        </div>
	</div>
<!--<input type="submit" class="btn btn-primary span3" name="submit" onclick="history.go(-1)" value="返回" />-->

<script language="javascript">
	require(['util'],function(util){
		util.editor($('.richtext-clone')[0]);
	})
	$(function(){
		require(['jquery','jquery.ui'],function($,j){
			$('#listfile').sortable({handle: '.fa-move'});
		})
	});
	{if !empty($par['comment']) && pdo_tableexists('dayu_comment') && !empty($row['commentid'])}
	function setStatus(obj,id,type,table){
		$(obj).html($(obj).html() + "...");
		$.post("{php echo murl('entry', array('do' => 'ajaxset','m' => 'dayu_comment'), true, true)}",{id:id,type:type,table:table, data: obj.getAttribute("data")},function(d){
			$(obj).html($(obj).html().replace("...",""));
			if(type=='recycle'){
				$(obj).html( d.data=='1'?'<i class="fa fa-check-square-o"></i> 正常显示':'<i class="fa fa-trash-o"></i> 放入回收站');
			}
			$(obj).attr("data",d.data);
			if(d.result==1){
				$(obj).toggleClass("label-success");
				$("#c_"+id).hide();
			}
		},"json");
	}
	{/if}
				
	function upfiles(){
		var data = new FormData($('#upbookfrom')[0]);
		$.ajax({
			url: '{php echo $this->createWebUrl('upfile')}',
			type: 'POST',
			data: data,
			dataType: 'html',
			cache: false,
			processData: false,
			contentType: false,
			error: function(msg){ //失败 
				alert('上传失败，请联系管理员.')
			}, 
			success: function(msgurl){ //成功 
				alert('上传成功');
				for(var i=0; i<1; i++){
					html = '<tr><td class="col-xs-12 col-sm-3 col-md-2 control-label"></td>' +
						'<td class="col-xs-12 col-sm-9"><input type="text" value="'+msgurl+'" name="file[]" class="form-control"></td>' +
						'<td><a href="javascript:;" onclick="deleteItem(this)" data-toggle="tooltip" data-placement="bottom" title="删除此文件" class="btn btn-default btn-sm"><i class="fa fa-times"></i></a></td>' +
						'</tr>';
					$('#listfile').append(html);
				}
			}
		},"json")
	}
					
	function deleteItem(o) {
		$(o).parent().parent().remove();
	}
					
</script>
{template 'common/footer'}